Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

217
Vistas
How to automatically fix node build imports that are without ".js" at the end?

I have a personal project using node.js, express.js and typescript.

When I run command to build project, it does all right.

But when I try to run it, it crashes, because all imports are "wrong", have a look:

The file dist/index.js has this import:

import app from './core/app';
...

BUT, if I make this change to the import, it runs ok:

import app from './core/app.js';
...

I didn't want to create a script file to do this, how can I solve it?

I'm currently using node version 16.0.

Here is my folder structure

enter image description here

Here is my index.ts

import app from 'src/core/app';

/**
 * Initializing server
 */
app.listen(app.get('port'), () => console.log('Application running -> true'));

Here is my tsconfig.json

{
    "compilerOptions": {
        "lib": ["ES2021"],
        "target": "ES2021",
        "module": "ES2020",
        "moduleResolution": "node",
        "strict": true,
        "baseUrl": ".",
        "sourceMap": true,
        "outDir": "dist",
        "rootDir": "src",
        "skipLibCheck": true,
        "noImplicitAny": true,
        "esModuleInterop": true,
        "isolatedModules": true,
        "removeComments": true,
        "resolveJsonModule": true,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "useUnknownInCatchVariables": true,
        "allowSyntheticDefaultImports": true,
        "strictPropertyInitialization": false,
        "forceConsistentCasingInFileNames": true,
        "typeRoots": ["node_modules/@types", "src/@types"]
    },
    "include": ["src/**/*"],
    "exclude": ["node_modules", "dist"]
}
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda